import request from '@/utils/request'
// 预警信息违规详情 API接口
const cre_warning_detailApi = {
    list: '/cre_warning_detail/list',
    save: '/cre_warning_detail/save',
    view: '/cre_warning_detail/view',
    del: '/cre_warning_detail/delete',
    dels: '/cre_warning_detail/batchDel',
    output: '/cre_warning_detail/output',
    exportExcelTemplate: '/cre_warning_detail/exportExcelTemplate',
    importExcel: '/cre_warning_detail/importExcel',
    queryListByWarnid: '/cre_warning_detail/queryListByWarnid',
}

/**
 * 根据预警id查询明细
 * @param {*} ids
 */
 export function queryListByWarnid (warnid) {
    return request({
        url: cre_warning_detailApi.queryListByWarnid,
        method: 'post',
        params: {warnid}
    })
}

/**
 * 导入预警信息违规详情Excel
 */
export function importExcel(data) {
  var body = new FormData()
  body.append("file", data);
  return request({
    url: cre_warning_detailApi.importExcel,
    headers: {"Content-Type": "multipart/form-data"},
    method: 'post',
    data: body
  })
}

/**
 * 导出预警信息违规详情Excel模板
 */
export function exportExcelTemplate () {
    return request({
        url: cre_warning_detailApi.exportExcelTemplate,
        method: 'post',
        responseType: 'blob'
    })
}

/**
 * 导出预警信息违规详情
 */
export function output (data) {
    return request({
        url: cre_warning_detailApi.output,
        method: 'post',
        data: data ,
        responseType: 'blob'
    })
}
/**
 * 批量删除预警信息违规详情
 * @param {*} ids
 */
export function delCre_warning_details (ids) {
    return request({
        url: cre_warning_detailApi.dels,
        method: 'post',
        params: {ids}
    })
}
/**
 * 删除预警信息违规详情
 * @param {*} id
 */
export function delCre_warning_detail (id) {
    return request({
        url: cre_warning_detailApi.del,
        method: 'post',
        params: {id}
    })
}
/**
 * 查看、编辑预警信息违规详情
 * @param {*} id
 */
export function viewCre_warning_detail (id) {
    return request({
        url: cre_warning_detailApi.view,
        method: 'get',
        params: {id}
    })
}
/**
 * 保存预警信息违规详情
 * @param {*} body
 */
export function saveCre_warning_detail (body) {
    return request({
        url: cre_warning_detailApi.save,
        method: 'post',
        data: body
    })
}
/**
 * 查询预警信息违规详情列表
 * @param {*} body
 */
export function queryCre_warning_detailList (body) {
    return request({
        url: cre_warning_detailApi.list,
        method: 'post',
        data: body
    })
}